package classtst_domain;

/**
 * @version 1.0
 * @auther liquan
 * @date 2025/3/17 19:59
 * @description
 */
public class MyDate {
    // 属性：
    public int year = 1990;
    public int month = 2;
    public int day = 26;
    // void showDate方法：打印日期。
    public void showDate(){
        System.out.println("日期：" + year + "年" + month + "月" + day + "日");
    }
    // boolean isLeapYear()方法：判断当前日期是否是闰年
    public boolean isLeapYear(){
        boolean flag = false;
        if (year % 4 == 0 && year % 100 != 0){
            flag = true;
        }
        else if (year % 400 == 0){
            flag = true;
        }
        else{
            flag = flag;
        }
        if (flag){
            System.out.println(year + "年不是闰年");
        }
        else{
            System.out.println(year + "年是闰年");
        }
        return flag;
    }

}
